﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameLibrary.Unit
{
    [Serializable]
    public class CurrentAbility
    {
        #region variables

        private float hp = 0;
        public float HP
        {
            get { return hp; }
            set { if (value > 0) hp = value; else hp = 0; }
        }
        private float ap = 0;
        public float AP
        {
            get { return ap; }
            set
            {
                if (value >= 0) ap = value;
                else ap = 0;
            }
        }
        public uint SP { get; set; }
        public uint Attack { get; set; }
        public uint Defence { get; set; }

        #endregion

        #region constructors

        public CurrentAbility(float hp, float ap,uint sp, uint attack, uint defence)
        {
            this.AP = ap;
            this.HP = hp;
            this.SP = sp;           
            this.Attack = attack;
            this.Defence = defence;
        }

        public CurrentAbility(CurrentAbility currentAbility)
        {
            this.HP = currentAbility.HP;
            this.AP = currentAbility.AP;
            this.SP = currentAbility.SP;
            this.Attack = currentAbility.Attack;
            this.Defence = currentAbility.Defence;
        }

        public CurrentAbility(Template t)
        {
            this.AP = t.AP;
            this.HP = t.HP;
            this.SP = t.SP;
            this.Attack = t.Attack;
            this.Defence = t.Defence;
        }

        #endregion

        #region reset

        public void Reset(Template template)
        {
            this.AP = (float)template.AP;
            this.HP = (float)template.HP;
            this.SP = template.SP;
            this.Attack = template.Attack;
            this.Defence = template.Defence;
        }

        #endregion
    }
}
